//
//  YSAboutCtrl.m
//  Yueshi
//
//  Created by Northwan on 15/8/7.
//  Copyright (c) 2015年 悦食中国. All rights reserved.
//  关于我们

#import "YSAboutCtrl.h"
#import "YSSetupInfoRes.h"
@interface YSAboutCtrl ()
@property (weak, nonatomic) IBOutlet UILabel *aboutContent;
@property (weak, nonatomic) IBOutlet UILabel *currentVersion;
@property (weak, nonatomic) IBOutlet UIButton *tipButton;
@property (strong, nonatomic) YSSetupInfoRes *app;

@end

@implementation YSAboutCtrl

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.navigationItem setTitle:@"关于悦食家"];
    [self.tipButton setHidden:YES];
    //显示是否有新版
    YSSetupInfoRes *app = [NSKeyedUnarchiver unarchiveObjectWithFile:YSAppInfoFilePath];
    if (app) {
        _app = app;
        [self.aboutContent setText:app.appAbout];
        [self.currentVersion setText:[NSString stringWithFormat:@"当前版本:%@",[SystemUtil getAppVersion]]];
        if([app.appVersion compare:[SystemUtil getAppVersion]]==NSOrderedDescending){
            //有新版
            [self.tipButton setHidden:NO];
        }
    }
}

- (IBAction)tapNext:(id)sender {
    if (_app) {
        if([_app.appVersion compare:[SystemUtil getAppVersion]]==NSOrderedDescending){
            NSString *url = @"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=";
            url = [url stringByAppendingString:kAppleId];
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
        }
    }
}


@end
